import*as e from"../../../core/platform/platform.js";import*as t from"../../../core/sdk/sdk.js";import*as r from"../../lit-html/lit-html.js";import*as o from"../helpers/helpers.js";const s=new CSSStyleSheet;s.replaceSync(".link{color:var(--color-link);text-decoration:underline;cursor:pointer;outline-offset:2px}\n/*# sourceURL=chromeLink.css */\n");class n extends HTMLElement{static litTagName=r.literal`devtools-chrome-link`;#e=this.attachShadow({mode:"open"});#t=this.#r.bind(this);#o="";connectedCallback(){this.#e.adoptedStyleSheets=[s],o.ScheduledRender.scheduleRender(this,this.#t)}set href(e){if(!e.startsWith("chrome://"))throw new Error("ChromeLink href needs to start with 'chrome://'");this.#o=e,o.ScheduledRender.scheduleRender(this,this.#t)}openSettingsTab(r){if("click"===r.type||"keydown"===r.type&&e.KeyboardUtilities.isEnterOrSpaceKey(r)){const e=t.TargetManager.TargetManager.instance().rootTarget();e&&e.targetAgent().invoke_createTarget({url:this.#o}),r.consume(!0)}}#r(){r.render(r.html` <a href="${this.#o}" class="link" target="_blank" @click="${this.openSettingsTab}" @keydown="${this.openSettingsTab}"><slot></slot></a> `,this.#e,{host:this})}}o.CustomElements.defineComponent("devtools-chrome-link",n);var i=Object.freeze({__proto__:null,ChromeLink:n});export{i as ChromeLink};
